<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <style>
        #king ul {
            list-style: none;
            padding: 0;
            display: flex;
        }
        #king li {
            width: 100px; /* 初始宽度 */
            overflow: hidden;
            transition: width 0.5s;
        }
        #king li.current {
            width: 300px; /* 选中项的宽度 */
        }
        .small {
            display: block;
        }
        .big {
            display: none;
        }
    </style>
</head>
<body>
    <div id="king">
        <ul>
            <li class="current">
                <a href="#">
                    <img src="../static/img/1.png" alt="Image 1 small" class="small">
                    <img src="../static/img/2.png" alt="Image 1 big" class="big">
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="../static/img/3.png" alt="Image 2 small" class="small">
                    <img src="../static/img/4.png" alt="Image 2 big" class="big">
                </a>
            </li>
            <li>
                <a href="#">
                    <img src="../static/img/5.png" alt="Image 3 small" class="small">
                    <img src="../static/img/6.png" alt="Image 3 big" class="big">
                </a>
            </li>
        </ul>
    </div>

    <script>
        $(document).ready(function() {
            $('#king li').mouseenter(function() {
                if ($(this).hasClass('current')) {
                    return;
                }
                
                $(this).addClass('current').stop().animate({
                    width: '300px'
                }).find('.small').stop().fadeOut().siblings('.big').stop().fadeIn();
                $('#king li').not(this).removeClass('current').stop().animate({
                    width: '100px'
                }).find('.small').stop().fadeIn().siblings('.big').stop().fadeOut();
            });
        });
    </script>
</body>
</html>
